package com.mimc.framework.events;
import com.jfinal.aop.Inject;
import com.mimc.common.constant.EventConstants;
import com.mimc.service.ShEmailService;
import io.jboot.components.event.JbootEvent;
import io.jboot.components.event.JbootEventListener;
import io.jboot.components.event.annotation.EventConfig;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;
@Slf4j
@EventConfig(action = {EventConstants.SENDEMAILEVENT})
public class SendEmailListener implements JbootEventListener {
    @Inject
    private ShEmailService shEmailService;
    @Override
    public void onEvent(JbootEvent event) {
        Map<String,Object> map=event.getData();
        String email=map.get("email").toString();
        String content=map.get("content").toString();
        String title=map.get("title").toString();
        shEmailService.sendEamil(email,title,content,false);
    }
}
